using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu(fileName = "New Item Effect", menuName = "Data/Effect/Thunder")]
public class ThunderItemEffect : ItemEffect
{
    [SerializeField] protected GameObject thunderStrikePerfabs;
    
    public override void EquipEffect()
    {
        base.EquipEffect();
        PlayerManager.instance.player.OnLastAttackDamage += ThunderStrike;
        
    }

    public void ThunderStrike(Enemy enemy)
    {
        int damage = PlayerManager.instance.player.GetComponent<CharacterStats>().lightingDamage.GetValue();
        GameObject thunder = Instantiate(thunderStrikePerfabs);
        thunder.GetComponent<ThunderStrikeControl>().SetThunder(enemy.transform.position,damage*3);
    }

    public override void UnEquipEffect()
    {
        base.UnEquipEffect();
        PlayerManager.instance.player.OnLastAttackDamage -= ThunderStrike;
    }
}
